• File: jde.php
  • Full Path: C:/htdocs/REEFTintegrationLog_test/REEFTintegrationLog/saved/jde.php
  • Date Modified: 04/30/2025 7:56 AM
  • File size: 4.46 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?php
//======================================================================================
//
// Function: Get hub_log => DATA-HUB - HUB_CONFIG
//
// Programmer: JKJ
// Date      : 2024-08-14
//
// Copyright Reeft A/S (c) - 2024
//======================================================================================

// datatables parameters:
// https://datatables.net/manual/server-side

//======================================================================================
// General config
//======================================================================================
	include "config/config.php";
	
//======================================================================================
// Set language
//======================================================================================

	include "include/set_language.php";
	
//======================================================================================
// Get input
//======================================================================================

//======================================================================================
// Get session variables
//======================================================================================
	include "include/getsession.php";

//======================================================================================
// Set language
//======================================================================================
	include "include/set_language.php";

//======================================================================================
// Connect to SQLite database in file
//======================================================================================

	$entries_found					= 0;

	$returnCode 					= '99';
	$returnMsg 						= 'No data found';

	$currentDate = date('Y-m-d');
	$currentTime = date('H:i:s');

//======================================================================================
// Set header
//======================================================================================

	header('Content-Type: application/json;charset=utf-8');

//======================================================================================
// Get time stamp
//======================================================================================
	$timeStamp = '';
	if ( $timeStamp == '' ) {
		$now = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''));
		$timeStamp = $now->format("Y-m-d H:i:s");
	}


	$data = array(
		"wcnt1" 		=> '',
		"wcnt2" 		=> '',
		"deltaDays" 	=> 200 
		);
	
//======================================================================================
// Make call to API somewhere
//======================================================================================
	
	$jsonData = json_encode($data);

	$json_pretty = json_encode(json_decode($jsonData), JSON_PRETTY_PRINT);
	echo $json_pretty;
	echo "<br>";
	// echo $url;
	
	
	$JDE_TOKEN = '044hC5JIN46ctmytpAwrK9qx2MxWj9OqHwBF50LjBx4qNE=MDE5MDEwMjg3MjA5OTEzNjQxOTE0NjAwODEwLjMwLjEuNDMxNzMzNzM1MTI4Nzc0';
	$JDE_TOKEN = '044mEjZm2W2xJFJ5uqubHVrH1WVLAgFXaramK+kk+H0rbo=MDE5MDEwNTYwODAzNDkxOTQ4NTczNjg4MTEwLjMwLjEuNDMxNzMzODM3MzAxOTYx';
	
	$headers = array(
         "Content-type: Content-Type:application/json",
		 "User-Agent: DATA-HUB 1.0",
         "jde-AIS-Auth: $JDE_TOKEN"
     );	

	
	// Set URL
	$url = 'http://jde-orchestrator-uat.int.electroluxprofessional.com/jderest/v3/orchestrator/ALFA_ORC_STOPTIME_GetWOList';
	$url = 'http://10.32.65.235/header.php';
	

	echo $url;

	// Create a new cURL resource
	$ch = curl_init($url);

	// Attach encoded JSON string to the POST fields
	curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);

	// Set the content type to application/json
	//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
	
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers );	

	// Return response instead of outputting
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    curl_setopt($ch, CURLOPT_POST, false);
	//curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' );
	curl_setopt($ch, CURLOPT_HEADER, false);    // we do not need headers
	curl_setopt($ch, CURLOPT_NOBODY, false);    // we don't need body

	// Execute the GET request
	$result = curl_exec($ch);

	$ary	= curl_getinfo($ch);

	// Close cURL resource
	curl_close($ch);
	
	$data = json_decode($result, true);
	
	
	echo $data;

?>